//vue antdesignvue 自动引入
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';

export default function () {
  return [
    AutoImport({
      include: [
        /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
        /\.vue$/,
        /\.vue\?vue/, // .vue
        /\.md$/, // .md
      ],
      resolvers: [AntDesignVueResolver()],
      //制定文件生成路径
      dts: 'src/types/auto-imports.d.ts',
      imports: ['vue', 'vue-router'],
    }),
    Components({
      dirs: ['src/components'],
      resolvers: [
        AntDesignVueResolver({
          importStyle: false,
        }),
      ],
      extensions: ['vue', 'md'],
      dts: 'src/types/auto-components.d.ts',
      exclude: [/[\\/]node_modules[\\/]/],
    }),
  ];
}
